import request from '@/utils/request'
import { param } from "@/utils";

export const getList = (query,data) => {
  return request({
    url: `/finance/loanedbill/page?${param(query)}`,
    method: 'post',
    data
  })
}

/**
 * 获取科目树
 */
export const getSubjectTree = () => {
  return request({
    url: '/finance/subject/tree'
  })
}

/**
 * 退回
 */
export const back = (data) => {
  return request({
    url: '/finance/loanedbill/batchBack',
    method: 'post',
    data
  })
}
/**
 * 添加记账
 */
export const add=(data)=>{
  return request({
    url:'/finance/loanedbill/addLoanedBill',
    method:'post',
    data
  })
}
/**
 * 编辑记账
 */
export const edit=(data)=>{
  return request({
    url:'/finance/loanedbill/editLoanedBill',
    method:'post',
    data
  })
}
/**
 * 批量记账
 */
export const batchBack=(data)=>{
  return request({
    url:'/finance/loanedbill/batchTally',
    method:'post',
    data
  })
}

/**
 * 发生额
 */
export const getSubjectStatistics=(data)=>{
  return request({
    url:'/finance/loanedbill/subjectStatistics',
    method:'post',
    data
  })
}
/**
 * 发生额导出
 */
export const exportSubjectStatistics=(data)=>{
  return request({
    url:'/finance/loanedbill/subjectStatisticsExport',
    method:'post',
    responseType:'blob',
    data
  })
}

/**
 * 记录导出
 */
export const exportRecord=(data)=>{
  return request({
    url:'/finance/loanedbill/exportLoanedBill',
    method:'post',
    responseType:'blob',
    data
  })
}

/**
 * 删除
 */
export const del=(loanedBillId)=>{
  return request({
    url:`/finance/loanedbill/delete/${loanedBillId}`,
  })
}

/**
 * 更改科目
 */
export const updateSubject=(data)=>{
  return request({
    url:'/finance/loanedbill/batchUpdateByRemark',
    method:'post',
    data
  })
}

/**
 * 获取凭证数
 */
export const getVoucherCount=(data)=>{
  return request({
    url:'/finance/loanedbill/statisticsCount',
    method:'post',
    data
  })
}